The present invention relates to a database querying method for querying databases. More specifically, the present invention relates to a technology that can be implemented effectively for a database querying method that queries databases in which newly added data types can be stored, e.g., object relational databases.
Queries to databases are performed using query languages provided by database management systems (DBMS). In relational databases, which are widely used, the query language is generally SQL (Structured Query Language), which is an international standard.
When querying a database, an application program must be developed in order to issue query statements expressed in a query language and to obtain query results. Development of this application program, however, requires specialized knowledge of the database and the query language and involves substantial effort. For this reason, query devices are provided to allow interactive querying of databases.
In a simple query device, query statements expresed in a query language are inputted directly, and the query results are displayed as strings or numerals. Using this type of query device requires knowledge about the database management system being queried and the query language thereof.
To allow easier querying of databases, there are also query devices that use a visual interface to allow interactive querying of a database. This type of query device can display tables and rows to be queried by obtaining them from the database and can also display lists of functions and operators reserved by the query language for use in search conditions for these tables and rows. The user making the query selects desired elements from the displayed lists and builds a query by combining these elements. The query results are displayed as strings and numerals. This allows databases to be queried easily even without a thorough understanding of the database management system or the query language thereof.
FIG. 16 is a drawing showing a sample architecture of a conventional query device. A database management system 100 interprets and executes a query statement expressed in a query language, and the query results (retrieved data) are returned as strings and numerals. Information relating to tables and rows from the database (database information) can also be returned as results for special queries.
A query device 150 issues query statements to a database management system 100 and acquires query result data and database information.
A query execution control module 101 controls the various modules in the query device 150 and coordinates data being passed between modules. A query input module 102 displays a list of operators and functions defined by the query language and a list of information relating to tables and rows from the tables acquired from the database in order to build query statements. The query input module 102 also provides an interface for selecting and combining these elements and handles query input.
A query results output module 103 displays strings and numerals from query results. A query statement generation module 104 uses the information from the query input module 102 to generate query statements. A database access module 105 is a database driver that connects to the database management system 100, issues the query statements generated by the query statement generation module 104, and retrieves data.
With advances in hardware and the growth of the WWW (World Wide Web), the field of database management is seeing a demand for management of databases containing multimedia data such as documents and images. Thus, there is a need to provide features for defining and managing complex data that could not be handled using the methods of conventional relational database management.
Object relational databases have been made available to extend relational databases to provide expanded handling of data models and allow complex abstract data type definitions.
Abstract data types allow data structures to be defined along with accessing operations of these structures in the form of methods. By limiting data structure access to the defined methods, the data structures can be hidden. Thus, the behavior of complex data can be defined in a safe manner, and complex queries can be issues for the data. Furthermore, systems in which these methods work with external modules can provide high-level data operations.
SQL3, which is currently being standardized, defines specifications for user-defined types including abstract data types. Multimedia data can be managed in a database according to standards by using these user-defined types to define multimedia data in a database.
In conventional query devices, queries can be performed for string and numerical data that have been pre-defined in the database management system, but data types that have been newly defined in the database cannot be queried.
With string and numerical data, the database management system clearly defines data processing methods, e.g., the types and meaning (use) of operators, data structures, and display methods. Thus, the query device can provide query functions based on these definitions. However, with newly defined data types, the definitions themselves can be obtained but it is not possible to determine how the data is to be processed.
For example, in order to manage structured documents with a database, a new structured document type is defined in the database. This structured document type provides the database with features such as the ability to perform high-speed searches of a specified string on specified structures in the document and the ability to embed information in documents to highlight strings that match search conditions.
However, for newly added structured document type data, conventional query devices do not have information about that kinds of searches that can be performed as well as what to retrieve as the search results and how to display these results. Thus, queries cannot use features specific to the structured document type (full-text search of specified structure and highlighted display).
Implementing queries that use these features requires the development of an application program to issue these queries. The development of this application program will require a deep understanding of the structured document type in addition to an understanding of the query language such as SQL and access methods for the database.
Also, generating query statements to be issued to the database management system requires a knowledge of the specifications of the methods provided by the structured document type as well as the meaning of the parameters to the method (e.g., the specifications of the query language for full-text searches and options for full-text searches). Not only must the methods used to acquire data be understood to display the data, but operations to interpret and display the format of the data returned by the method must also be designed.
When a new data type is added to the database, conventional query devices cannot be used to query this data type. In order to perform querying, effort must be expended to create an application program that manipulates the data type. This type of problem will come up each time a new data type, such as images or maps, is added to the database.
The object of the present invention is to overcome the problems described above and to provide a technology that allows data types newly added to a database to be queried in the same manner as conventional data types without requiring specialized knowledge of the data type.
The present invention provides a method for querying a database in which new data types can be defined where query statements are issued and query results are obtained. When querying data belonging to a newly defined data type, a query component for assisting in the query is activated to assist in querying data belonging to the particular data type.
In the present invention, when a new data type is defined in the database management system, information relating to a query component for assisting queries of data belonging to the newly defined data type, along with information about the data type, is registered in a query component information.
When a query to the database management system is inputted in the database query device, the data type being queried is evaluated to see whether it is a newly added data type or not.
If the data type being queried is a newly added data type, the query component information is searched for a query component for assisting querying data belonging to the particular data type.
When the query component for assisting querying of data belonging to the data type is found, the found query component is activated and a screen is displayed for entry of the information needed in querying data belonging to the data type.
The user inputs the information needed to query the data belonging to the data type into the screen. The database query device generates a query statement using the entered information. The generated query statements are issued to the database management system and query results are retrieved.
With the database querying method according to the present invention as described above, if a data type being queried is a newly defined data type, a query component is activated to assist in the entry of the information needed for querying. When a new data type is added to the database, querying can be performed in the same manner as with conventional data types even without specialized knowledge about the data type.